Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making refresh rate controllable from CLI #30

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

aodhan-domhnaill
Copy link

Per #29

Copy link
Contributor

@njogz njogz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@@ -11,6 +11,7 @@ module.exports = function() {
.option('--changes-limit [value]', 'number of changes to batch')
.option('--postgres-table [value]', 'name of the postgres table to replicate to')
.option('-d, --daemon', 'continually replicate between CouchDB and PostgresSQL')
.option('-s, --sleep', 'Sleep interval in milliseconds between runs in daemon mode (default 10 * 60 * 60 * 1000 [ms] = 10 hrs)')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we come up with a better name for this parameter? I'm thinking --sleep-interval or --polling-interval or something more descriptive?

Secondly, commander allows setting defaults which would save a little code later on, eg:

Suggested change
.option('-s, --sleep', 'Sleep interval in milliseconds between runs in daemon mode (default 10 * 60 * 60 * 1000 [ms] = 10 hrs)')
.option('-s, --sleep', 'Sleep interval in milliseconds between runs in daemon mode', 10 * 60 * 60 * 1000)

There are even more complicated options if you want to parse the variable or provide a human readable default value. More info in their documentation.

Copy link
Member

@garethbowen garethbowen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice addition! I've left a comment inline about parameter naming and using more advanced features of commander.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants